<?

/**
* Init the drop down content
*
* @param  string  $COracle
* @param  string  $cvtName              this drop down name
* @param  string  $curLevelD            current convertion level depth
* @param  string  $cvtTo                selected convert name
* @param  string  $unit       
* @param  string  $propListConvertion
* @param  string  $srcDb
* @param  string  $listCvtContent       the content of dropDown
* 
*/
function initListConvertion(&$COracle,
                            &$cvtName,
                            &$curLevelD,
                            &$cvtTo,
                            &$unit,
                            &$propListConvertion,
                            &$srcDb,
                            &$listCvtContent){
                              
  fetchLstConvertion($COracle,
                     $curLevelD,
                     $unit,
                     $srcDb,
                     $list);
                      
  $listCvtContent = CGHtml::formDropDown($cvtName,
                                         $unit,
                                         $list,
                                         $propListConvertion);
}

/**
* Calculate the Dlvr qty based on 
* user's selected convertion
*
* @param  string  $COracle
* @param  string  $usrConvertion
* @param  string  $unit
* @param  string  $srcDb
* @param  string  $dlvrQty
*
*/
function calcDlvrQty( &$COracle,
                      &$usrConvertion,
                      &$cvtTo,
                      &$unit,
                      &$srcDlvrQty,
                      &$srcDb,
                      &$dlvrQty){
  
  /**
  * Check if the user was changed the 
  * convertion base
  * YES: Calc the convertion value
  * NO : return back the source value
  *
  */                      
  if($usrConvertion != $unit){
    
    fetchQtyConvertion($COracle,
                       $unit,
                       $usrConvertion,
                       $srcDb,
                       $qtyConvertion);
    
    $dlvrQty = round(($srcDlvrQty * $qtyConvertion), 0);
    
  }else{
    
    $dlvrQty = $srcDlvrQty;
  }
}
?>